package cn.xbtop.blog.controller;

import cn.xbtop.blog.utils.Result;
import cn.xbtop.blog.utils.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Mxb
 * @version 1.0
 * @date 2020/4/16 14:06
 */
@RestController
@RequestMapping("/upload")
public class UploadController {
    @Autowired
    private UploadService uploadService;

    @RequestMapping("/uploadImage")
    public Result<String> uploadImage(MultipartFile file){
        String url = uploadService.uploadImage(file);
        return new Result<>("上传成功！",url);
    }
}
